package com.fileupload.fileupload.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Semaphore;

@Configuration
public class SemaphoreConfig {
    /**
     * 配置读excel文件的信号量
     * @return
     */
    @Bean(name = "readExcelSemaphore")
    public Semaphore getReadrExcelSemaphore(){
        // 允许同时处理2个文件
        return new Semaphore(2);
    }

    @Bean(name = "exportExcelSemaphore")
    public Semaphore getExportExcelSemaphore(){
        // 允许同时处理2个文件
        return new Semaphore(2);
    }
}
